import { fetchUserFollowing } from '@/lib/api/account/profile';
import FollowList from '../_component/FollowList';

type Props = {
	params: Promise<{ sid: string }>;
};

const PER_PAGE = 20;

export default async function UserFollowingPage({ params }: Props) {
	const { sid } = await params;
	const res = await fetchUserFollowing(sid, 1, PER_PAGE);
	const data = res.data ?? { total: 0, list: [] };

	return (
		<>
			<h2 className="user-profile__subtab-title">팔로우</h2>
			<FollowList
				mode="following"
				memberSID={sid}
				initialList={data.list}
				initialTotal={data.total}
				initialPage={1}
				perPage={PER_PAGE}
			/>
		</>
	);
}